function add(nums: number[]): number {
  return nums.reduce((acc, num) => acc + num, 0)
}

console.log(add([1, 2, 3, 4, 5])) // Output: 15